<?php
	/*功能：添加选择下拉框的分类*/
	$tabName = htmlentities(trim($_POST['tabName']));
	$token = $_POST['token'];
	if(!$tabName || !$token){
		echo "parm is miss";
		exit;
	}
	require '../autoload.php';

	//验证token
	if(!token_v('add_tabtype',$token)){
		exit('token is error');
	}

	//数据比对及添加
	$mp = new MyPdo();
	$sql = "select id from translate_type where name = ?";
	$arr = array($tabName);
	$res = $mp->dql($sql,$arr,1);
	if($res){
		echo 'tabName is exists!';	//
	}else{
		$sql = "insert into translate_type values(null,?)";
		$arr = array($tabName);
		$res = $mp->dml($sql,$arr);
		if($res){
			Clear_TableType();
			Clear_InfoAll();
			echo 'ok';
		}else{
			echo 'insert is error';
		}
	}